#!/bin/bash

#Fix names for partitions
#
#Authors:
#  Flavio Pereira de Oliveira <www.goblinx.com.br>
#
#License: GPLv2 or later
#################################################


for i in $(lshal -s | grep volume); do
if [ "$(lshal --show $i | grep volume.label | cut -f2 -d "'")" = "" ]; then
hal-set-property --udi $(lshal --show $i | grep info.udi | cut -f2 -d "'" ) --key info.product --string $(lshal --show $i | grep block.device | cut -f2 -d "'" | cut -f 3 -d "/")
hal-set-property --udi $(lshal --show $i | grep info.udi | cut -f2 -d "'" ) --key volume.label --string $(lshal --show $i | grep block.device | cut -f2 -d "'" | cut -f 3 -d "/")
fi
done
